/***************************************************************************
 *            historico.h
 *
 *  Ter julho 12 08:31:25 2011
 *  Copyright  2011  Jónison Almeida dos Santos
 *  <user@host>
 ****************************************************************************/

#include <bibliotecas.h>
#include <cadastro.h>

#ifndef __HISTORICO_H__
#define __HISTORICO_H__ 1

class PLANILHA : public Gtk::TreeModel::ColumnRecord
	{
	public : 
		/** Construtor */
		PLANILHA ();
		/** Destrutor */
		~PLANILHA ();
		Gtk::TreeModelColumn<int> reg; /**<*/
		Gtk::TreeModelColumn<string> data;/**<*/
		Gtk::TreeModelColumn<string> contador;/**<*/
		Gtk::TreeModelColumn<Glib::ustring> descricao;/**<*/
		Gtk::TreeModelColumn<Glib::ustring> campo[21];	/**<*/
	};

class HISTORICO
	{
	public:
		/** Construtor*/
		HISTORICO( bool *, BANCOPG *);
		/** Destrutor*/
		~HISTORICO();
		Gtk::Window Historico_Geral;/**<*/
		Gtk::Window Historico_Producao;/**<*/
		Gtk::Window Historico_Desenvolvimento;/**<*/
		
	private:
		BANCOPG *conexao;/**<*/
		char *cod_apiario;/**<*/
			
	protected:
		/** */
		void janela_historico();
		/** */
		void janela_producao ();
		/** */
		void janela_histgeral();
		/** */
		void Fechou_Janela();
		/** */
		void set_posicao(Gtk::Entry * , int );
		/** */
		void setar_focus(Gtk::Window *, Gtk::Widget *, int);
		/** */
		void configuracao_datahora(int);
		/** */
		void listar_dados(int);
		/** */
		void armazenar_registro(int);
		/** */
		void abrir_janela();
		/** */
		void visualizacao_treeview();
		/** */
		void limpar_janela();
		/** */
		void selecionado(const Gtk::TreeModel::Path& path,Gtk::TreeViewColumn* column);

		int entry_ativa;/**<*/
		typedef std::map<int, Glib::ustring> type_actions_map;/**<*/
		type_actions_map m_CompletionActions;/**<*/

		//Janela Historico Principal
		Gtk::Frame *Geral;/**<*/
		Gtk::VBox Box_Historico;/**<*/
		Gtk::HBox Box_Geral;/**<*/
		Gtk::HBox Box_Geral2;/**<*/
		Gtk::HBox Box_Geral3;/**<*/
		Gtk::Label *labgeral;  /**<Label Usada dinamicamente em todas as janelas do historico*/
		Gtk::Entry ent_apiario;/**<*/
		Gtk::ComboBoxText CB_Opcao;/**<*/
		
		//**********Janela Produção - Frame, Botões e Entrys******
		int cod_lua;/**<*/
		int cod_janela;/**<*/
		int cod_situacao;/**<*/
		int cod_nota;/**<*/
		Gtk::HBox Box_Menu;/**<*/
		Gtk::HBox Box_Linha0;/**<*/
		Gtk::HBox Box_Linha1;/**<*/
		Gtk::HBox Box_Linha2;/**<*/
		Gtk::HBox Box_Linha3;/**<*/
		Gtk::HBox Box_Linha4;/**<*/
		Gtk::HBox Box_Linha5;/**<*/
		Gtk::HBox Box_Linha6;/**<*/
		int cod_registro;/**<para o metodo selecionado, que pega a linha da treeview*/
		int contar_data;/**<*/
		int dia1;/**<*/
		int dia2;/**<*/
		int mes1;/**<*/
		int mes2;/**<*/
		Gtk::VBox Box_Producao;/**<*/
		Gtk::Frame *Producao;/**<*/
		//Gtk::Label *labgeral;
		Gtk::Entry ent_DataRev;/**<*/
		Gtk::Entry ent_Nump;/**<*/
		Gtk::Entry ent_melgueiracol;/**<*/
		Gtk::Entry ent_totalkg;/**<*/
		Gtk::Entry ent_melgremanes;/**<*/
		Gtk::Entry ent_espaco;/**<*/
		Gtk::Entry ent_kgremanes;/**<*/
		Gtk::Entry ent_intro;/**<*/
		Gtk::Entry ent_rainha;/**<*/
		Gtk::Entry ent_mae;/**<*/
		Gtk::Entry ent_geracao;/**<*/
		Gtk::Entry ent_situacao;/**<*/
		Gtk::Entry ent_nota;/**<*/
		Gtk::Entry ent_obs; /**<*/
		Gtk::Entry ent_Horai;/**<*/
		Gtk::Entry ent_Horaf;/**<*/
		Gtk::Entry ent_Colmeia;/**<*/

		Gtk::ComboBoxText CB_Lua;/**<*/
		Gtk::ComboBoxText CB_Nota;/**<*/
		Gtk::ComboBoxText CB_Situacao;/**<*/
	
		Gtk::VBox Principal;/**<*/
		Gtk::VBox VB_Producao;/**<*/
		Gtk::HBox HB_Colmeias;/**<*/
		Gtk::HBox HB_Producao;/**<*/
		Gtk::TreeView CT_Historico;/**<Gtk::TreeView da tela PRINCIPAL::historico.*/
		Gtk::ScrolledWindow CS_Historico;/**<Gtk::ScrolledWindow do PRINCIPAL::CT_historico.*/

		Gtk::ScrolledWindow SW_obs;/**<*/
		Gtk::TextView TV_obs;/**<*/
		Gtk::Button Gerar;/**<*/
		Gtk::Button Sair;/**<*/
		Gtk::Button Gravar;/**<*/
		Gtk::Button Cancelar;/**<*/
		Gtk::Button Limpar;/**<*/
		Gtk::Image *Gravar_Image;/**<*/

		Glib::RefPtr<Gtk::TextBuffer> TB_Obs ; /**<Box de texto para OBS.*/
				
		int flag;/**<*/
		int total_geral;/**<*/
		int limite;/**<*/
		int offset;/**<*/
		int pagina;/**<*/
		int paginas;/**<*/
		int total_registros;/**<*/
		int total_colunas;/**<*/
		int pos_atual;/**<*/
		int posicao;/**<*/
		int total;/**<*/
		int len_ant;
		bool *controle_hist;/**<*/
		bool verificador_salvar;/**<*/
		string id_colmeia;/**<*/
		string data_form;/**<*/
		string id_api;/**<*/
		string id_abelharainha;/**<*/
	
		Gtk::Frame *Hist_Plan;/**<*/
		Gtk::Frame *Visualizacao;/**<*/
					
		Gtk::ScrolledWindow ScrollPlan;/**<*/
		Gtk::TextView listaHistorico;/**<*/

		//Tratamento das TreeViews
		Glib::RefPtr<Gtk::ListStore> opcao_lista;/**<*/
		Glib::RefPtr<Gtk::ListStore> apiario_lista;/**<*/
		Glib::RefPtr<Gtk::ListStore> ponteiro_lista;/**<*/
		Glib::RefPtr<Gtk::ListStore> nota_lista;/**<*/
		Glib::RefPtr<Gtk::ListStore> situacao_lista;/**<*/
		Glib::RefPtr<Gtk::ListStore> colmeia_lista;/**<*/
		Glib::RefPtr<Gtk::ListStore> abelharainha_lista;/**<*/
		Glib::ustring dados[20][5];/**<*/	
		PLANILHA Planilha_Reg;/**<*/
		PLANILHA Nota_Reg;/**<*/

		Gtk::ScrolledWindow scrollHist;	/**<*/
		Gtk::TreeView Planilha_Historico;/**<*/
		Gtk::Button BRegistrar;/**<*/
		Gtk::Button BAlterar;/**<*/
		Gtk::Button BRemover;/**<*/
		Gtk::TreeModel::Row celula;/**<*/
	
		Gtk::HSeparator separador1;/**<Linhas entre as boxes*/

	};
#endif

		
